﻿#pragma once


#include "MaterialGraph/Node/MaterialGraphNodeViewModel.h"
#include "MaterialTextureNodeViewModel.m.h"

class RMaterialGraphNodeModel;
class RMaterialTextureNodeModel;
class RMaterialGraphPinViewModel;
class RTexture2D;

RCLASS()
class RMaterialTextureNodeViewModel : public RMaterialGraphNodeViewModel
{
    ROBJECT
    
public:
    virtual void BindModel(
        TSharedObjectPtr<RMaterialGraphNodeModel> InModel
        , TSharedObjectPtr<RMaterialGraphViewModel> InGraph
        )  override;

    virtual float GetNodeWidth() const  override{ return 200.0f; }
    virtual int64_t GetLineNum() const override;
    virtual CString GetName() const override { return U"图片/纹理";};
    virtual CString GetInputPinName(int64_t Index) const override;
    virtual CString GetOutputPinName(int64_t Index) const ;

    virtual bool PotentiallyIsOrIsParameter() const override { return true; }
    virtual bool IsParameter() const override ;
    virtual void ToggleParameter()override ;
    virtual CString GetParameterName() const override;
    virtual void SetParameterName(const CString & InName) override;

    TSharedObjectPtr<RTexture2D> GetTexture() const;
    CString GetTextureDisplayName() const;

    int64_t GetPopupMenuHeight() const  { return 400; }
    int64_t GetPopupMenuWidth() const  { return 200; }

public:
    void SelectTexture(TSharedObjectPtr<RTexture2D> InTexture);
protected:
    TWeakObjectPtr<RMaterialTextureNodeModel> TextureModel;

};